﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Winproof.Intro;

namespace Winproof
{
    public partial class Winproof : Form
    {

        ///////////////////////////////////////  폼 이동 ///////////////////////////////////////

        public const int WM_NCLBUTTONDOWN = 0xA1;
        public const int HTCAPTION = 0x2;
        [DllImportAttribute("user32.dll")]
        public static extern bool ReleaseCapture();
        [DllImportAttribute("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
        private void Titlepanel_MouseDown(object sender, MouseEventArgs e)
        {
            //If the left mouse is pressed, release form for movement
            if (e.Button == MouseButtons.Left)
            {
                ReleaseCapture();
                SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
            }
        }
        ////////////////////////////////   메뉴 설정 /////////////////////////////////////////

        public enum POSITION { HOME, PACKET, ANALYSIS, SETTING };
        
        public POSITION Po;

        public IntroHome IntroHome;
        public IntroPacket IntroPacket;
        public IntroAnalysis IntroAnalysis;
        public IntroSetting IntroSetting;

       

        public void PositionCheck(POSITION P)
        {
            Po = P;

            HomeButton.ColorBase = Color.WhiteSmoke;
            HomeButton.ColorBaseStroke = Color.Transparent;

            NomalButton.ColorBase = Color.WhiteSmoke;
            NomalButton.ColorBaseStroke = Color.Transparent;

            DocumentButton.ColorBase = Color.WhiteSmoke;
            DocumentButton.ColorBaseStroke = Color.Transparent;

            SettingButton.ColorBase = Color.WhiteSmoke;
            SettingButton.ColorBaseStroke = Color.Transparent;


            switch (P)
            {
                case POSITION.HOME:

                    
                    HomeButton.ColorBase = Color.LightGoldenrodYellow;
                    HomeButton.ColorBaseStroke = Color.FromArgb(100, 76, 76, 64);
                    

                    IntroHome.Show();
                    IntroPacket.Hide();
                    IntroAnalysis.Hide();
                    IntroSetting.Hide();

                    break;
                case POSITION.PACKET:

                    NomalButton.ColorBase = Color.LightGoldenrodYellow;
                    NomalButton.ColorBaseStroke = Color.FromArgb(100, 76, 76, 64);

                    IntroHome.Hide();
                    IntroAnalysis.Hide();
                    IntroPacket.Show();
                    IntroSetting.Hide();

                    break;

                case POSITION.ANALYSIS:

                    DocumentButton.ColorBase = Color.LightGoldenrodYellow;
                    DocumentButton.ColorBaseStroke = Color.FromArgb(100, 76, 76, 64);

                    IntroHome.Hide();
                    IntroPacket.Hide();
                    IntroAnalysis.Show();
                    IntroSetting.Hide();

                    break;

                case POSITION.SETTING:

                    SettingButton.ColorBase = Color.LightGoldenrodYellow;
                    SettingButton.ColorBaseStroke = Color.FromArgb(100, 76, 76, 64);

                    IntroHome.Hide();
                    IntroPacket.Hide();
                    IntroAnalysis.Hide();
                    IntroSetting.Show();

                    break;
            }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////



        public Winproof()
        {
            InitializeComponent();

            /////////////////////////////////////////////////////
            IntroHome = new IntroHome();
            IntroPacket = new IntroPacket();
            IntroAnalysis = new IntroAnalysis();
            IntroSetting = new IntroSetting();

            this.Controls.Add(IntroPacket);
            this.Controls.Add(IntroHome);
            this.Controls.Add(IntroAnalysis);
            this.Controls.Add(IntroSetting);
            /////////////////////////////////////////////////////

            PositionCheck(POSITION.HOME);
            this.DoubleBuffered = true;
        }

        private void pictureBox1_MouseEnter(object sender, EventArgs e)
        {
            pictureBox1.BackgroundImage = Properties.Resources.bar_1;
        }

        private void pictureBox1_MouseLeave(object sender, EventArgs e)
        {
            pictureBox1.BackgroundImage = null;
        }

        private void pictureBox2_MouseEnter(object sender, EventArgs e)
        {
            pictureBox2.BackgroundImage = Properties.Resources.bar_2;
        }

        private void pictureBox2_MouseLeave(object sender, EventArgs e)
        {
            pictureBox2.BackgroundImage = null;
        }

        private void pictureBoxexit_MouseEnter(object sender, EventArgs e)
        {

            pictureBoxexit.BackgroundImage = Properties.Resources.bar_3;
        }

        private void pictureBoxexit_MouseLeave(object sender, EventArgs e)
        {
            pictureBoxexit.BackgroundImage = null;
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void pictureBoxexit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void HomeButton_Click(object sender, EventArgs e)
        {
            PositionCheck(POSITION.HOME);
        }

        private void NomalButton_Click(object sender, EventArgs e)
        {
            PositionCheck(POSITION.PACKET);
        }

        private void DocumentButton_Click(object sender, EventArgs e)
        {
            PositionCheck(POSITION.ANALYSIS);
        }

        private void SettingButton_Click(object sender, EventArgs e)
        {
            PositionCheck(POSITION.SETTING);
        }

       


    }
}
